package org.systemsbiology.rface.hadoop.reducers;

import org.apache.hadoop.mapreduce.Reducer;
import org.systemsbiology.hadoop.ioformats.LexicalKey;
import org.systemsbiology.rface.hadoop.data.ResultGroup;
import org.systemsbiology.rface.hadoop.data.StatAggregation;

import java.io.IOException;

/**
 * Created by IntelliJ IDEA.
 * User: anorberg
 * Date: 10/20/11
 * Time: 3:28 PM
 */
public class CalculateStatistics extends Reducer<LexicalKey, ResultGroup, LexicalKey, StatAggregation> {
    @Override
    protected void reduce(LexicalKey key, Iterable<ResultGroup> values, Context context) throws IOException, InterruptedException{
        context.write(key, new StatAggregation(ResultGroup.merge(values)));
    }
}
